import request from './request'

// 获取聊天历史记录
export function getChatHistory (params) {
  return request({
    url: '/chat/history',
    method: 'get',
    params
  })
}

// 发送消息
export function sendMessage (data) {
  return request({
    url: '/chat/send',
    method: 'post',
    data
  })
}

// 获取在线用户列表
export function getOnlineUsers () {
  return request({
    url: '/chat/online-users',
    method: 'get'
  })
}

// 标记消息为已读
export function markAsRead (messageId) {
  return request({
    url: `/chat/read/${messageId}`,
    method: 'put'
  })
}

// 客服推送消息
export function pushMessage (data) {
  return request({
    url: '/chat/push',
    method: 'post',
    data
  })
}
